/**
 * LocationAPITools library, version 1.0.2
 * 
 * WWW: http://code.google.com/p/locationapitools
 *   
 * Summary:
 *   A collection of classes that simplify the development of location-aware mobile
 *   applications using the JSR-179 Location API on the J2ME (CLDC/MIDP) platform,
 *   e.g. on GPS-equipped smartphones.
 * 
 * Author:
 *   Matthias Stevens (Sony CSL Paris / Vrije Universiteit Brussel)
 *   Contact: matthias.stevens@gmail.com
 *  
 * Description:
 *   The primary use case is a location tracker that stores tracks in KML
 *   (cfr. Google Earth/Maps), CSV or plain text format.
 * 
 *   Package "com.sony.csl.j2me.locationapitools.demo" contains a MIDlet class that
 *   demonstrates how LocationAPITools can be used to create simple GPS tracker
 *   application that produces KML files. For examples of more advanced uses of this
 *   library refer to the NoiseTube project (see below, look for "NoiseTube MobileNoiseTagger").
 * 
 *   The code is known to be working on the following Symbian OS-based platforms:
 *     * S60 3rd Edition Feature Pack 1 (Symbian OS 9.2), e.g.: Nokia N95 and Nokia N95 8GB smartphones
 *     * S60 3rd Edition Feature Pack 2 (Symbian OS 9.3) 
 *   Although this is untested, the code should also work on other (non-Symbian/S60)
 *   J2ME CLDC/MIDP platforms/devices, as long as the JSR-179 Location API is supported
 *   on the platform/device in question.
 * 
 *   This library was developed within the scope of the NoiseTube project at
 *   Sony Computer Science Laboratory (CSL) Paris, for more information please refer to:
 *     * http://noisetube.net
 *     * http://code.google.com/p/noisetube
 *     * http://www.csl.sony.fr 
 *    
 * License: 
 *   Copyright 2008-2009 Sony CSL Paris
 *   Licensed under the Apache License, Version 2.0 (the "License"); you may not use
 *   this file except in compliance with the License. You may obtain a copy of the
 *   License at http://www.apache.org/licenses/LICENSE-2.0.
 *   Unless required by applicable law or agreed to in writing, software distributed
 *   under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 *   CONDITIONS OF ANY KIND, either express or implied. See the License for the
 *   specific language governing permissions and limitations under the License.
 */

package com.sony.csl.j2me.locationapitools.tracking;

import com.sony.csl.j2me.util.CustomStringBuffer;

/**
 * A KMLStlye subclass that implements a default KML layout.
 * 
 * @author mstevens
 *
 */
public class DefaultKMLStyle extends KMLStyle
{

	public String getApplicationName()
	{
		return "LocationAPITools";
	}

	/**
	 * @see com.sony.csl.j2me.locationapitools.tracking.KMLStyle#getStyleDefinitions(int)
	 */
	public String getStyleDefinitions(int tabs)
	{
		CustomStringBuffer bff = new CustomStringBuffer(250);
		bff.appendTabbedLine("<StyleMap id=\"location\">", tabs);
		bff.appendTabbedLine("<Pair>", tabs + 1);
		bff.appendTabbedLine("<key>normal</key>", 4);
		bff.appendTabbedLine("<styleUrl>#location_normal</styleUrl>", tabs + 2);
		bff.appendTabbedLine("</Pair>", tabs + 1);
		bff.appendTabbedLine("<Pair>", tabs + 1);
		bff.appendTabbedLine("<key>highlight</key>", tabs + 2);
		bff.appendTabbedLine("<styleUrl>#location_highlighted</styleUrl>", tabs + 2);
		bff.appendTabbedLine("</Pair>", tabs + 1);
		bff.appendTabbedLine("</StyleMap>", tabs);
		bff.appendTabbedLine("<Style id=\"location_normal\">", tabs);
		bff.appendTabbedLine("<IconStyle>", tabs + 1);
		bff.appendTabbedLine("<color>ff00ffff</color>", tabs + 2);
		bff.appendTabbedLine("<scale>0.5</scale>", tabs + 2);
		bff.appendTabbedLine("<Icon>", tabs + 2);
		bff.appendTabbedLine("<href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>", tabs + 3);
		bff.appendTabbedLine("</Icon>", tabs + 2);
		bff.appendTabbedLine("</IconStyle>", tabs + 1);
		bff.appendTabbedLine("<LabelStyle>", tabs + 1);
		bff.appendTabbedLine("<scale>0</scale>", tabs + 2); //hide labels on locations (unless highlighted)
		bff.appendTabbedLine("</LabelStyle>", tabs + 1);
		bff.appendTabbedLine("</Style>", tabs);
		bff.appendTabbedLine("<Style id=\"location_highlighted\">", tabs);
		bff.appendTabbedLine("<IconStyle>", tabs + 1);
		bff.appendTabbedLine("<color>ff00ffff</color>", tabs + 2);
		bff.appendTabbedLine("<Icon>", tabs + 2);
		bff.appendTabbedLine("<href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>", tabs + 3);
		bff.appendTabbedLine("</Icon>", tabs + 2);
		bff.appendTabbedLine("</IconStyle>", tabs + 1);
		bff.appendTabbedLine("</Style>", tabs);
		bff.appendTabbedLine("<Style id=\"trackline\">", tabs);
		bff.appendTabbedLine("<LineStyle>", tabs + 1);
		bff.appendTabbedLine("<color>b2ff0055</color>", tabs + 2);
		bff.appendTabbedLine("<width>8</width>", tabs + 2);
		bff.appendTabbedLine("</LineStyle>", tabs + 1);
		bff.appendTabbedLine("</Style>", tabs);
		bff.appendTabbedLine("<Style id=\"boundingbox\">", tabs);
		bff.appendTabbedLine("<LineStyle>", tabs + 1);
		bff.appendTabbedLine("<color>cc0000ff</color>", tabs + 2);
		bff.appendTabbedLine("<width>10</width>", tabs + 2);
		bff.appendTabbedLine("</LineStyle>", tabs + 1);
		bff.appendTabbedLine("<PolyStyle>", tabs + 1);
		bff.appendTabbedLine("<color>99ffffff</color>", tabs + 2);
		bff.appendTabbedLine("</PolyStyle>", tabs + 1);
		bff.appendTabbedLine("</Style>", tabs);
		return bff.toString();
	}

	/**
	 * @see com.sony.csl.j2me.locationapitools.tracking.KMLStyle#getLocationStyleURL()
	 */
	public String getLocationStyleURL()
	{
		return "#location";
	}
	
	/**
	 * @see com.sony.csl.j2me.locationapitools.tracking.KMLStyle#getBoundingBoxStyleURL()
	 */
	public String getBoundingBoxStyleURL()
	{
		return "#boundingbox";
	}

	/**
	 * @see com.sony.csl.j2me.locationapitools.tracking.KMLStyle#getTrackLineStyleURL()
	 */
	public String getTrackLineStyleURL()
	{
		return "#trackline";
	}

}
